<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>区域管理</title>
	
	<script src="${ctx}/static/detailPopover/areaGroupDetail.js" type="text/javascript"></script>
</head>

<body>
	<c:if test="${not empty message}">
		<div id="message" class="alert alert-success">
			<button data-dismiss="alert" class="close">×</button>
			${message}
		</div>
	</c:if>
	<div class="row">
		<div class="span4 offset6">
			<form class="form-search" action="#">
			 	<label>区域名称：</label>
			 	<input type="text" name="search_LIKE_areaName" class="input-medium" value="${param.search_LIKE_areaName}"> 
			    <button type="submit" class="btn">搜索</button>
		    </form>
	    </div>
	</div>
	<%-- <div>
		<a class="btn btn-primary" href="${ctx}/area/create">创建区域</a>
	</div>
	<br> --%>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	区域名 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=areaName_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=areaName_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	所属网点 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=areaGroup_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=areaGroup_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	区域类型 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=areaType_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=areaType_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	区域代码 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=areaCode_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=areaCode_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	邮政编码 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=zipCode_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=zipCode_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<th>
					<div class="nav dropdown pull-left">
					    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					    	上级行政区域 <b class="caret"></b>
					    </a>
						<ul class="dropdown-menu" >
						   	<li><a href="?sortType=area_desc&${searchParams}">降序</a></li>
						   	<li><a href="?sortType=area_asc&${searchParams}">升序</a></li>
						</ul>
					</div>
				</th>
				<!-- <th>管理</th> -->
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${areas.content}" var="area">
			<tr>
				<td>
					<%-- <a href="${ctx}/area/update/${area.id}"> --%>
						${area.areaName}
					<!-- </a> -->
				</td>
				<td>
					<a href="#areaGroupDetail" onclick="areaGroupDetailAjax('${area.areaGroup.id}','${ctx}')" data-toggle="modal">
						${area.areaGroup.groupName}
					</a>			
				</td>
				<td>
					<c:if test="${area.areaType eq '1'}">国家</c:if>
					<c:if  test="${area.areaType eq '2'}">省/自治区/直辖市</c:if>
					<c:if test="${area.areaType eq '3'}">城市/地级市</c:if>
					<c:if test="${area.areaType eq '4'}">县/县级市/区</c:if>
					<c:if test="${area.areaType eq 'abroad'}">海外</c:if>
				</td>
				<td>${area.areaCode}</td>
				<td>${area.zipCode}</td>
				<td>${area.area.areaName}</td>
				<%-- <td>
					<a href="#delete_${area.id}" role="button" class="btn btn-danger" data-toggle="modal">删除</a>
 
					<div id="delete_${area.id}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-body">
							<h4>确定删除${area.areaName}吗？</h4>
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">返回</button>
							<a class="btn btn-danger" href="${ctx}/area/delete/${area.id}">确定</a>
						</div>
					</div>
				</td> --%>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	
	<tags:pagination page="${areas}" paginationSize="5"/>
	
	<div id="areaGroupDetail"  class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" role="dialog">
		<div class="modal-header">
			<h3>网点详情</h3>
		</div>
		<div class="modal-body">
			<table id="areaGroupDetailBody" class="table table-striped table-bordered table-condensed"></table>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">返回</button>
		</div>
	</div>
</body>
</html>
